document.write('<link rel="stylesheet" href="/assets/img/icons/iconfont.css"></link>');
document.write('<link rel="stylesheet" href="/assets/css/more.css"></link>');
let tmpHtml = ``
// 跳转页面
function jumpPage(path) {
    // 本页面路径
    let curPage = window.location.href;
    // 判断是否为当前页，若是则刷新
    if (curPage.includes(path)) {
        return;
    }
    // 跳转
    window.location.href = path;
}
    if (document.getElementById("menu")) {
        var userAgent = navigator.userAgent.toLowerCase();
        var isMobile = /mobile/i.test(userAgent);
        if (!isMobile) {
            tmpHtml = `<div class="navigation-box computed">
            <div class="navigation">
                <span style="--i:0;--x:-1;--y:0">
                    <p class="tooltiptext">简历</p>
                    <ion-icon class="iconfont icon-gerenjianli" onclick="jumpPage('/pages/vitae.html')"></ion-icon>
                </span>
                <span style="--i:1;--x:1;--y:0">
                    <p class="tooltiptext">首页</p>
                    <ion-icon class="iconfont icon-xiangmujingyan" onclick="jumpPage('/index.html')"></ion-icon>
                </span>
                <span style="--i:2;--x:0;--y:-1">
                    <p class="tooltiptext-top">博客</p>
                    <ion-icon class="iconfont icon-blogger" onclick="jumpPage('/pages/blog.html')"></ion-icon>
                </span>
                <span style="--i:3;--x:0;--y:1">
                    <p class="tooltiptext">联系方式</p>
                    <ion-icon class="iconfont icon-dianhua" onclick="jumpPage('tel:15302464434')"></ion-icon>
                </span>
                <span style="--i:4;--x:0;--y:0">
                    <ion-icon class="iconfont icon-quancha"></ion-icon>
                </span>
            </div>
            </div>`
        }else{
            tmpHtml = `<div class="navigation-box android">
                            <div class="navigation">
                                <span style="--i:0;--x:-1;--y:0">
                                    <b onclick="jumpPage('/pages/vitae.html')">简历</b>
                                </span>
                                <span style="--i:1;--x:1;--y:0">
                                    <b onclick="jumpPage('/index.html')">首页</b>
                                </span>
                                <span style="--i:2;--x:0;--y:-1">
                                    <b onclick="jumpPage('/pages/blog.html')">博客</b>
                                </span>
                                <span style="--i:3;--x:0;--y:1">
                                    <b onclick="jumpPage('tel:15302464434')">联系方式</b>
                                </span>
                                <span style="--i:4;--x:0;--y:0">
                                    <ion-icon class="iconfont icon-quancha"></ion-icon>
                                </span>
                            </div>
                        </div>`
        }
        
    }else{
        throw('请定义一个id为menu的标签')
    }
    // 先生成html然后给标签添加点击事件
    let menu = document.getElementById('menu');
    menu.innerHTML = tmpHtml;
    menu.onclick = function(){
        let navigation = document.querySelector('.navigation');
        navigation.classList.toggle('active');
    }